package com.diandi.ddsb.bean;

/**
 * 互动类型
 *
 */

public enum InteractiveType {
	DEFAULT(1, "默认"), LIMIT_PEOPLE_NUM(2, "限人数"), LOTTERY(3, "抽奖"), CLASSIFICATION_TYPE(4, "分级类型");
	/**
	 * value
	 */
	private final String text;
	/**
	 * key
	 */
	private final int value;

	InteractiveType(int value, String text) {
		this.value = value;
		this.text = text;
	}

	public static InteractiveType getTextByValue(int value) {
		for (InteractiveType item : InteractiveType.values()) {
			if (item.getValue() == value) {
				return item;
			}
		}
		throw new RuntimeException(value + "不是合法的类型！");
	}

	public static InteractiveType getValueByText(String text) {
		for (InteractiveType item : InteractiveType.values()) {
			if (item.getText().equals(text)) {
				return item;
			}
		}
		throw new RuntimeException(text + "不是合法的类型！");
	}

	public String getText() {
		return text;
	}

	public int getValue() {
		return value;
	}

}
